﻿using System;
using System.Text;
using System.Collections.Generic;
using DinheiroSobControle.Dominio;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace DinheiroSobControle.Testes.Dominio
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class MovimentacaoFinanceiraTest
    {
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void TestGastoValorNegativo()
        {
            new Gasto(-1m);
        }

        [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void TestGastoValorZero()
        {
            new Gasto(0m);
        }

        [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void TestRecebimentoValorNegativo()
        {
            new Recebimento(-1m);
        }

        [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void TestRecebimentoValorZero()
        {
            new Recebimento(0m);
        }

        [TestMethod]
        public void TestVerificaCategoriaDeGastoDefault()
        {
            Assert.AreEqual( CategoriaDeGasto.Compras, new Gasto(3).CategoriaDeGasto, 
                             "O valor default para categoria de gastos deve ser 'Compras'");
        }

        [TestMethod]
        public void TestVerificaFormaDePagamentoDefault()
        {
            Assert.AreEqual(FormaDePagamento.AVista, new Gasto(3).FormaDePagamento,
                            "O valor default para forma de pagamento deve ser 'AVista'");
        }

        [TestMethod]
        public void TestVerificarCategoriaDeRecebimentoDefault()
        {
            //Assert.AreEqual( CategoriaDeRecebimento.Salario, new Recebimento(3).CategoriaDeRecebimento,
            //  "O valor default para a categorias de recebimentos deve ser 'Salário'");
        }

        [TestMethod]
        public void TestVerificaDataDeGastoDefault()
        {
            Assert.AreEqual(DateTime.Now, new Gasto(4).Data);
        }
    }
}